package com.maila.xiaoaobusiness.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.maila.xiaoaobusiness.R;
import com.maila.xiaoaobusiness.widget.NoScrollListView;
import com.zhy.autolayout.AutoLinearLayout;
import com.zhy.autolayout.AutoRelativeLayout;
import com.zhy.autolayout.utils.AutoUtils;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by mark on 2017/12/2.
 */

public class OrderAdapter extends BaseAdapter {
    Context context;

    public OrderAdapter(Context context) {
        this.context = context;
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_order, parent, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
            AutoUtils.autoSize(convertView);
        } else {
            holder = (ViewHolder) convertView.getTag();

        }
        holder.lvGoods.setAdapter(new OrderGoodAdapter(context));
        return convertView;
    }

    static class ViewHolder {
        @BindView(R.id.tv_user_name)
        TextView tvUserName;
        @BindView(R.id.tv_user_phone)
        TextView tvUserPhone;
        @BindView(R.id.btn_call_user)
        AutoLinearLayout btnCallUser;
        @BindView(R.id.tv_user_address)
        TextView tvUserAddress;
        @BindView(R.id.tv_user_note_massage)
        TextView tvUserNoteMassage;
        @BindView(R.id.tv_dispatcher_name)
        TextView tvDispatcherName;
        @BindView(R.id.tv_dispatcher_phone)
        TextView tvDispatcherPhone;
        @BindView(R.id.btn_call_dispatcher)
        AutoLinearLayout btnCallDispatcher;
        @BindView(R.id.ll_dispatcher_info)
        AutoRelativeLayout llDispatcherInfo;
        @BindView(R.id.iv_lv_icon)
        ImageView ivLvIcon;
        @BindView(R.id.lv_goods)
        NoScrollListView lvGoods;
        @BindView(R.id.tv_pack_fee)
        TextView tvPackFee;
        @BindView(R.id.tv_discount_fee)
        TextView tvDiscountFee;
        @BindView(R.id.tv_trans_fee)
        TextView tvTransFee;
        @BindView(R.id.tv_total_fee)
        TextView tvTotalFee;
        @BindView(R.id.tv_xiaoao_server_fee)
        TextView tvXiaoaoServerFee;
        @BindView(R.id.tv_earn_total_money)
        TextView tvEarnTotalMoney;
        @BindView(R.id.tv_user_act_pay)
        TextView tvUserActPay;
        @BindView(R.id.tv_order_status_hint)
        TextView tvOrderStatusHint;
        @BindView(R.id.btn_confirm_order_status)
        TextView btnConfirmOrderStatus;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
